// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

package llnl.visit.operators;

import llnl.visit.AttributeSubject;
import llnl.visit.CommunicationBuffer;
import llnl.visit.Plugin;
import java.lang.Integer;
import java.util.Vector;

// ****************************************************************************
// Class: RemoveCellsAttributes
//
// Purpose:
//    This class contains attributes for the RemoveCells operator.
//
// Notes:      Autogenerated by xml2java.
//
// Programmer: xml2java
// Creation:   omitted
//
// Modifications:
//
// ****************************************************************************

public class RemoveCellsAttributes extends AttributeSubject implements Plugin
{
    private static int RemoveCellsAttributes_numAdditionalAtts = 2;

    public RemoveCellsAttributes()
    {
        super(RemoveCellsAttributes_numAdditionalAtts);

        cellList = new Vector();
        domainList = new Vector();
    }

    public RemoveCellsAttributes(int nMoreFields)
    {
        super(RemoveCellsAttributes_numAdditionalAtts + nMoreFields);

        cellList = new Vector();
        domainList = new Vector();
    }

    public RemoveCellsAttributes(RemoveCellsAttributes obj)
    {
        super(obj);

        int i;

        cellList = new Vector();
        for(i = 0; i < obj.cellList.size(); ++i)
        {
            Integer iv = (Integer)obj.cellList.elementAt(i);
            cellList.addElement(new Integer(iv.intValue()));
        }
        domainList = new Vector();
        for(i = 0; i < obj.domainList.size(); ++i)
        {
            Integer iv = (Integer)obj.domainList.elementAt(i);
            domainList.addElement(new Integer(iv.intValue()));
        }

        SelectAll();
    }

    public int Offset()
    {
        return super.Offset() + super.GetNumAdditionalAttributes();
    }

    public int GetNumAdditionalAttributes()
    {
        return RemoveCellsAttributes_numAdditionalAtts;
    }

    public boolean equals(RemoveCellsAttributes obj)
    {
        int i;

        // Compare the elements in the cellList vector.
        boolean cellList_equal = (obj.cellList.size() == cellList.size());
        for(i = 0; (i < cellList.size()) && cellList_equal; ++i)
        {
            // Make references to Integer from Object.
            Integer cellList1 = (Integer)cellList.elementAt(i);
            Integer cellList2 = (Integer)obj.cellList.elementAt(i);
            cellList_equal = cellList1.equals(cellList2);
        }
        // Compare the elements in the domainList vector.
        boolean domainList_equal = (obj.domainList.size() == domainList.size());
        for(i = 0; (i < domainList.size()) && domainList_equal; ++i)
        {
            // Make references to Integer from Object.
            Integer domainList1 = (Integer)domainList.elementAt(i);
            Integer domainList2 = (Integer)obj.domainList.elementAt(i);
            domainList_equal = domainList1.equals(domainList2);
        }
        // Create the return value
        return (cellList_equal &&
                domainList_equal);
    }

    public String GetName() { return "RemoveCells"; }
    public String GetVersion() { return "1.0"; }

    // Property setting methods
    public void SetCellList(Vector cellList_)
    {
        cellList = cellList_;
        Select(0);
    }

    public void SetDomainList(Vector domainList_)
    {
        domainList = domainList_;
        Select(1);
    }

    // Property getting methods
    public Vector GetCellList() { return cellList; }
    public Vector GetDomainList() { return domainList; }

    // Write and read methods.
    public void WriteAtts(CommunicationBuffer buf)
    {
        if(WriteSelect(0, buf))
            buf.WriteIntVector(cellList);
        if(WriteSelect(1, buf))
            buf.WriteIntVector(domainList);
    }

    public void ReadAtts(int index, CommunicationBuffer buf)
    {
        switch(index)
        {
        case 0:
            SetCellList(buf.ReadIntVector());
            break;
        case 1:
            SetDomainList(buf.ReadIntVector());
            break;
        }
    }

    public String toString(String indent)
    {
        String str = new String();
        str = str + intVectorToString("cellList", cellList, indent) + "\n";
        str = str + intVectorToString("domainList", domainList, indent) + "\n";
        return str;
    }


    // Attributes
    private Vector cellList; // vector of Integer objects
    private Vector domainList; // vector of Integer objects
}

